package com.beuth.taskList.model;

import java.util.ArrayList;
import java.util.List;

public class TaskModel {
	
	private static TaskModel instance = null;

	private TaskModel() {
	}

	public static TaskModel getInstance() {
		if (instance == null) {
			instance = new TaskModel();
		}
		return instance;
	}
	
	private List<Task> tasks = new ArrayList<Task>();
	private Task currentEditTask = null;
	
	
	public void removeTask(Task task) {
		tasks.remove(task);
	}
	
	public void addTask(Task task) {
		tasks.add(task);
	}
	
	public List<Task> getTasks() {
		return tasks;
	}

	public Task getCurrentEditTask() {
		return currentEditTask;
	}

	public void setCurrentEditTask(Task currentEditTask) {
		this.currentEditTask = currentEditTask;
	}
	
	public String toString() {
		String s = "";
		for (int i = 0; i<this.tasks.size(); i++) {
			s += this.tasks.get(i).getName();
			s += " ";
		}
		return s;
	}
}
